#ifndef _CTRL_CONV_DATA_H
#define _CTRL_CONV_DATA_H
#include "CMediaFile.h"
#include "ui_CtrlConvData.h"
#include <QDialog>
#include <QStringList>
#include <QThread>
#include <qcontainerfwd.h>
#include <qobject.h>
#include <qtmetamacros.h>

class CThreadConv : public QThread {
  Q_OBJECT

public:
  CThreadConv(QWidget *parent){};
  ~CThreadConv(){};

public:
  int ConvFormat(QString file, QString outfile);
  int SaveRadarFile(SEI_MAP &data);

public:
  void SetStop(bool stop) { stop_ = stop; };
  bool stop_ = true;
  int SetFileList(QStringList list) {
    file_list_ = list;
    return 0;
  };
  int SetOutputFolder(QString Folder) {
    folder_output_ = Folder;
    return 0;
  };

private:
  QStringList file_list_;
  QString folder_output_;
  SEI_MAP sei_map_;

private:
  int SaveRadarFile(QString file, SEI_MAP &data);

protected:
  void run();
signals:
  void finished(int process);
  void setText(QString str);
};

class CtrlConvData : public QDialog {
  Q_OBJECT

public:
  CtrlConvData(QWidget *parent);
  ~CtrlConvData();

private:
  Ui::CtrlConvData ui;

public:
  void OnInitWindow();

private slots:
  void on_pbInputBrowse_clicked();
  void on_pbOutputBrowse_clicked();
  void on_pbStart_clicked();
  void on_pbStop_clicked();

private:
  void SearchAllFileInPath(QString path);

public slots:
  int SetProcess(int proc);
  void AddMsg(QString msg);

public:
  int Start();

private:
  QStringList file_list_;
  QString folder_input_;
  QString folder_output_;
  CThreadConv *thread_conv_;
};

#endif